package com.shaoshaohuo.app.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.adapter.MyGridAdapter;
import com.shaoshaohuo.app.entity.NewUserInfo;
import com.shaoshaohuo.app.framework.SharedPreferencesHelper;
import com.shaoshaohuo.app.net.HttpConfig;
import com.shaoshaohuo.app.net.RequestParam;
import com.shaoshaohuo.app.net.ShopHttpConfig;
import com.shaoshaohuo.app.ui.BaseActivity;
import com.shaoshaohuo.app.ui.BianJi;
import com.shaoshaohuo.app.ui.BusinessEnterActivity;
import com.shaoshaohuo.app.ui.CheckFailActivity;
import com.shaoshaohuo.app.ui.CheckFinishActivity;
import com.shaoshaohuo.app.ui.CollectivefarmActivity;
import com.shaoshaohuo.app.ui.DeliveryaddressActivity;
import com.shaoshaohuo.app.ui.MainTabActivity;
import com.shaoshaohuo.app.ui.MyCouponActivity;
import com.shaoshaohuo.app.ui.ShopAllOrderActivity;
import com.shaoshaohuo.app.ui.WaitCheckActivity;
import com.shaoshaohuo.app.utils.CircleImageView;
import com.shaoshaohuo.app.utils.Okhttputils;
import com.shaoshaohuo.app.utils.ToastUtil;
import com.shaoshaohuo.app.utils.im.IMFactory;
import com.shaoshaohuo.app.view.ShareDialog;
import com.squareup.picasso.Picasso;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import okhttp3.Call;
import okhttp3.Response;


/**
 * 我的
 *
 * @author
 */
public class MyInfoFragment extends Fragment implements OnClickListener, AdapterView.OnItemClickListener {
    private GridView user_gridView;
    private List<Integer> picture_list;
    private List<String> word_list;
    private MyGridAdapter adapter;
    private CircleImageView user_picture;
    private ImageView user_share;
    private ImageView user_bianji;
    private ImageView user_duihuan;
    private ImageView user_look;
    private ImageView user_dingdan;
    private TextView user_quduihuan;
    private TextView user_chakan;
    private TextView user_phone;
    private RelativeLayout user_my_dingdan;
    private View mContentView;
    private TextView user_coupon;
    private TextView user_jifen;
    private String mArgument;
    public static final String ARGUMENT = "argument";

    private Handler handler = new Handler();
    private NewUserInfo userInfoEntity;
    //    BaseUserInfo baseUserInfo;
    private RelativeLayout my_info_apply_suzerain;//商家入驻

    public static MyInfoFragment newInstance(String argument) {
        Bundle bundle = new Bundle();
        bundle.putString(ARGUMENT, argument);
        MyInfoFragment contentFragment = new MyInfoFragment();
        contentFragment.setArguments(bundle);
        return contentFragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        if (bundle != null)
            mArgument = bundle.getString(ARGUMENT);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        if (mContentView == null) {
            mContentView = inflater.inflate(R.layout.fragment_my_info, null);
            getData();
            initView();
            setAdapter();
            setListener();
            RequestData();
        } else {
            ViewGroup parent = (ViewGroup) mContentView.getParent();
            if (parent != null) {
                parent.removeView(mContentView);
            }
        }
//        View viewById=mContentView.findViewById(R.id.topbar);
        //沉浸式适配方案！！！！！！！！！！！！！很關鍵
        ((MainTabActivity) getActivity()).maintabchangeStatusBar(BaseActivity.TransltestausModel.TOPPicter, -1);
        View myinfor_fg_toprela = mContentView.findViewById(R.id.myinfor_fg_toprela);
        ViewGroup.LayoutParams layoutParams = myinfor_fg_toprela.getLayoutParams();
        layoutParams.height += BaseActivity.getStatusBarHeight(getContext());
        myinfor_fg_toprela.setLayoutParams(layoutParams);
        return mContentView;
    }


    private void setAdapter() {
//        user_gridView.setAdapter(adapter);

    }

    private void getData() {
        picture_list = new ArrayList<>();
        word_list = new ArrayList<>();
        word_list.add("待付款");
        picture_list.add(R.drawable.daifukuan);
        word_list.add("待发货");
        picture_list.add(R.drawable.daifahuo);
        word_list.add("待确认");
        picture_list.add(R.drawable.daishouhuo);
        word_list.add("待退款");
        picture_list.add(R.drawable.tuikuan);
        word_list.add("我的收藏");
        picture_list.add(R.drawable.deisltea_shoucang);
        word_list.add("收货地址");
        picture_list.add(R.drawable.shouhuo_weidian);
        picture_list.add(R.drawable.xiaoxi);
        word_list.add("客服");
    }


    private void initView() {
        my_info_apply_suzerain = (RelativeLayout) mContentView.findViewById(R.id.my_info_apply_suzerain);//商家入驻
        user_picture = (CircleImageView) mContentView.findViewById(R.id.user_picture);
        user_duihuan = (ImageView) mContentView.findViewById(R.id.user_duihuan);
        user_look = (ImageView) mContentView.findViewById(R.id.user_look);
        user_dingdan = (ImageView) mContentView.findViewById(R.id.user_dingdan);
        user_quduihuan = (TextView) mContentView.findViewById(R.id.user_quduihuan);
        user_share = (ImageView) mContentView.findViewById(R.id.user_share);
        user_bianji = (ImageView) mContentView.findViewById(R.id.user_bianji);
        user_chakan = (TextView) mContentView.findViewById(R.id.user_chakan);
        user_jifen = (TextView) mContentView.findViewById(R.id.user_jifen);
        user_gridView = (GridView) mContentView.findViewById(R.id.user_grid);
        ViewGroup.LayoutParams layoutParams = user_gridView.getLayoutParams();
        layoutParams.height = getContext().getResources().getDisplayMetrics().heightPixels / 3;
        user_phone = (TextView) mContentView.findViewById(R.id.user_phone);
        user_coupon = (TextView) mContentView.findViewById(R.id.user_coupon);
        user_gridView.setNumColumns(4);
        user_my_dingdan = (RelativeLayout) mContentView.findViewById(R.id.user_my_dingdan);
        adapter = new MyGridAdapter(picture_list, word_list, getContext());
        user_gridView.setAdapter(adapter);
    }

    private void setListener() {
        user_picture.setOnClickListener(this);
        user_share.setOnClickListener(this);
        user_bianji.setOnClickListener(this);
        user_duihuan.setOnClickListener(this);
        user_look.setOnClickListener(this);
        user_dingdan.setOnClickListener(this);
        user_quduihuan.setOnClickListener(this);
        user_chakan.setOnClickListener(this);
        user_my_dingdan.setOnClickListener(this);
        user_gridView.setOnItemClickListener(this);
        my_info_apply_suzerain.setOnClickListener(this);
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        Log.e("TAG", "onHiddenChanged: ===================" + hidden);
        if (!hidden) {
            RequestData();
        }
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.user_bianji:
                //dengLu
                if (userInfoEntity != null) {
                    intent.setClass(getActivity(), BianJi.class);
                    intent.putExtra("imaphto", userInfoEntity.getData().getBaseinfo().getAvatar());
                    intent.putExtra("phonenum", userInfoEntity.getData().getBaseinfo().getMobile());
                    startActivity(intent);
                }
                break;
            case R.id.user_share:
                //fenxiang
                ShareDialog shareDialog = new ShareDialog(getContext());
                shareDialog.show();
                break;
            case R.id.user_quduihuan:
                //兑换积分
//                Toast.makeText(getContext(), "兑换积分", Toast.LENGTH_SHORT).show();
                break;
            case R.id.user_duihuan:
                //兑换积分
//                Toast.makeText(getContext(), "兑换积分", Toast.LENGTH_SHORT).show();
                break;
            case R.id.user_chakan:
                //查看优惠券
//                Toast.makeText(getContext(), "查看优惠券", Toast.LENGTH_SHORT).show();
                intent.setClass(getActivity(), MyCouponActivity.class);
                startActivity(intent);
                break;
            case R.id.user_look:
                //查看优惠券
//                Toast.makeText(getContext(), "查看优惠券", Toast.LENGTH_SHORT).show();
                intent.setClass(getActivity(), MyCouponActivity.class);
                startActivity(intent);
                break;
            case R.id.user_my_dingdan:
                //查看全部订单
                intent.setClass(getActivity(), new ShopAllOrderActivity().newInstance(intent, "全部", 0).getClass());
                startActivity(intent);
                break;
            case R.id.my_info_apply_suzerain:
                //商家入驻
                ShopHttpConfig.quereystatus(getContext(), new Okhttputils.OkutListener() {
                    @Override
                    public void error(Call call, IOException e) {

                    }

                    @Override
                    public void error(Call call, int code) {

                    }

                    @Override
                    public void suseff(Call call, Response response, Object o) {
                        Status status = (Status) o;
                        int status1 = status.getData().getStatus();
                        Intent intent1 = new Intent();
                        switch (status1) {
                            case 1:
                                //没有认证过
                                intent1.setClass(getActivity(), BusinessEnterActivity.class);
                                startActivity(intent1);
                                break;
                            case 2:
                                //该商户正在审核过
                                intent1.setClass(getActivity(), WaitCheckActivity.class);
                                startActivity(intent1);
                                break;

                            case 3:
//                                该商户审核通过
                                SharedPreferencesHelper sharedPreferencesHelper = new SharedPreferencesHelper();
                                String once = sharedPreferencesHelper.getString("once", "1");
                                if (once.equals("1")) {
                                    sharedPreferencesHelper.setString("once", "2");
                                    intent1.setClass(getActivity(), CheckFinishActivity.class);
                                    startActivity(intent1);
                                } else if (once.equals("2")) {
                                    intent1.setClass(getActivity(), CollectivefarmActivity.class);
                                    startActivity(intent1);
                                }
//                                intent1.setClass(getActivity(), CollectivefarmActivity.class);
//                                startActivity(intent1);
                                break;
                            case 4:
                                //该商户审核没有通过
                                intent1.setClass(getActivity(), CheckFailActivity.class);
                                startActivity(intent1);
                                break;
                        }
                    }
                }, Status.class);

                break;
        }

    }

    //网络请求

    public void RequestData() {
//        ((BaseActivity) getActivity()).startLoadingDialog();
        Map<String, String> map = RequestParam.getHeaderParams();
        Okhttputils.Instanse(getActivity()).getnet(map, getActivity(), HttpConfig.BASE_HOST_URL + HttpConfig.SubUrl.GET_USER_INFO, new Okhttputils.OkutListener() {
            @Override
            public void error(Call call, IOException e) {

            }

            @Override
            public void error(Call call, int code) {

            }

            @Override
            public void suseff(Call call, Response response, Object o) {
                userInfoEntity = (NewUserInfo) o;
                //数据解析成功
                if (userInfoEntity.getCode() == 0) {
                    //成功


                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            //赋值
                            NewUserInfo.Baseinfo baseinfo = userInfoEntity.getData().getBaseinfo();
                            adapter.setBaseUserInfoList(baseinfo);
                            //头像
                            String avatar = baseinfo.getAvatar();
                            //手机号
                            String mobile = baseinfo.getMobile();
                            /**
                             *   "points": "120",                                         //新参数   积分数
                             "couponNum": "0",                                    //新参数   优惠券的数量
                             "waitPayNum": "1",                                   //新参数   待支付数量
                             "waitPushNum": "1",    							  //新参数   待发货数量
                             "waitBackMoneyNum": "1",                       //新参数   待退款数量
                             "waitAcceptNum": "1",                              //新参数   待收货数量
                             */
                            //积分
                            String points = baseinfo.getPoints();
                            if (TextUtils.isEmpty(points)) {
                                points = "0";
                            }
                            //优惠券
                            String couponNum = baseinfo.getCouponNum();
                            //待支付
                            String waitPayNum = baseinfo.getWaitPayNum();
                            //代发货
                            String waitPushNum = baseinfo.getWaitPushNum();
                            //待退款
                            String waitBackMoneyNum = baseinfo.getWaitBackMoneyNum();
                            //待收货
                            String waitAcceptNum = baseinfo.getWaitAcceptNum();
                            user_jifen.setText(points);
                            user_coupon.setText(couponNum);
                            String substring = mobile.substring(3, 7);
                            String replace = mobile.replace(substring, "****");
                            user_phone.setText(replace);

                            // .placeholder(R.drawable.user_placeholder)
//    .error(R.drawable.user_placeholder_error)
                            if (!TextUtils.isEmpty(avatar)) {
                                Picasso.with(getContext()).load(avatar).error(R.mipmap.zhanzhanzhan).placeholder(R.mipmap.zhanzhanzhan).into(user_picture);
                            }

                        }
                    });
                } else {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            ToastUtil.toast(userInfoEntity.getMsg());
                        }
                    });
                }


//                baseUserInfo = userInfoEntity.getData().getBaseinfo();
//                baseUserInfoList.add(baseUserInfo);
//                Log.e("666", baseUserInfo.getMobile());
//                setView();
//                adapter.notifyDataSetChanged();
            }
        }, NewUserInfo.class);
    }

    //gridView 监听
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        Intent intent = new Intent();
//        Log.e("shujusssss", word_list.get(position));
        if (position >= 0 && position < 3) {
            intent.setClass(getActivity(), new ShopAllOrderActivity().newInstance(intent, word_list.get(position), position + 1).getClass());
            startActivity(intent);
        } else {
            Log.e("", "");
        }
        if (position == 3) {
            intent.setClass(getActivity(), new ShopAllOrderActivity().newInstance(intent, word_list.get(position), position + 2).getClass());
            startActivity(intent);
        }
        if (position == 5) {
            Intent intent1 = new Intent(getContext(), DeliveryaddressActivity.class);
            startActivity(intent1);
        }
        if (position == 4) {
            Intent intent2 = new Intent(getContext(), NewCollection.class);
            startActivity(intent2);
        }
        if (position == 6) {
            IMFactory.openChatServiceContact(getActivity());
        }
    }

//    private void requestData() {
//        if (AccountManager.isLogin()) {
//            BaseUserInfo userInfo = AccountManager.getUserInfo();
//            if (userInfo != null) {
//                String authStatus = AccountManager.getUserAuthStatus();
//                ImageLoader.getInstance().displayImage(userInfo.getAvatar(), mHeadView,
//                        ImageLoadUtil.getDisplayImageOptions(R.drawable.pic_head_ad, 180));
//                getAccountDetail();
//
//                initModifyPassword();
//
//                tv_name.setText(userInfo.getRealname());
//
//
//            }
//        } else {
//            mOverageView.setText("未登录");
//        }
//
//    }

    /**
     * 判断是否设置了 支付密码
     */
//    private void initModifyPassword() {
//        String isHavePasswd = SharedPreferencesHelper.getString("isHavePasswd", "-1");
//
//        if ("1".equals(isHavePasswd)) {
//            isSetPassword();
//        } else if ("0".equals(isHavePasswd)) {
//            isNoSetPassword();
//        } else if ("-1".equals(isHavePasswd)) {
//            RequestService.getInstance().checkPayPwd(getActivity(), CheckPayPwdEntity.class, new RequestListener() {
//                @Override
//                public void onSuccess(int requestCode, BaseEntity resultData) {
//                    if (resultData.isOk()) {
//                        CheckPayPwdEntity entity = (CheckPayPwdEntity) resultData;
//                        String isset = entity.getData().getIsset();
//                        if ("1".equals(isset)) {
//                            isSetPassword();
//                        } else if ("0".equals(isset)) {
//                            isNoSetPassword();
//                        }
//                        SharedPreferencesHelper.setString("isHavePasswd", isset);
//                    }
//                }
//
//                @Override
//                public void onFailed(int requestCode, Exception error, String msg) {
//                }
//            });
//        }
//    }

//    //如果设置了支付密码
//    public void isSetPassword() {
//        mPayPasswordTextView.setText("修改支付密码");
//        isHavePasswd = true;
//    }
//
//    //如果没有设置支付密码
//    public void isNoSetPassword() {
//        mPayPasswordTextView.setText("设置支付密码");
//        isHavePasswd = false;
//    }

//    private void initView() {
//        mTopbarView = (TopbarView) mContentView.findViewById(R.id.topbar);
//        mTopbarView.setCenterText("我的");
//        mTopbarView.setLeftView(false, false);
//        mTopbarView.setRightImage(R.drawable.icon_set_white_ad);
//        mTopbarView.setRightClickListener(new OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                startActivity(new Intent(getActivity(), SettingActivity.class));
//            }
//        });
//
//        mHeadView = (ImageView) mContentView.findViewById(R.id.iv_head);
//        mOverageView = (TextView) mContentView.findViewById(R.id.tv_overage);
//        mPrepaidView = (TextView) mContentView.findViewById(R.id.tv_prepaid);
//        mMoneyView = (TextView) mContentView.findViewById(R.id.tv_money);
//        mMoneyDetilView = (LinearLayout) mContentView.findViewById(R.id.ll_money_detil);
//        mPayPasswordView = (LinearLayout) mContentView.findViewById(R.id.ll_pay_password);
//        mPayPasswordTextView = (TextView) mContentView.findViewById(R.id.tv_pay_password);
//        mCouponView = (LinearLayout) mContentView.findViewById(R.id.ll_coupon);
//        mMyPointsView = (LinearLayout) mContentView.findViewById(R.id.ll_my_points);
//        mBrowseRecord = (LinearLayout) mContentView.findViewById(R.id.ll_browse_record);
//        mShareAppView = (LinearLayout) mContentView.findViewById(R.id.ll_share_app);
//
//        ll_pay_account = (LinearLayout) mContentView.findViewById(R.id.ll_pay_account);//1.8
//
//        ll_my_address = (LinearLayout) mContentView.findViewById(R.id.ll_my_address); // 1.8.2
//        ll_my_comment = (LinearLayout) mContentView.findViewById(R.id.ll_my_comment);
//
//        tv_modify_info = (TextView) mContentView.findViewById(R.id.tv_modify_info);
//        tv_name = (TextView) mContentView.findViewById(R.id.tv_name);
//
//        ll_user_info = (LinearLayout) mContentView.findViewById(R.id.ll_user_info);
//
//        iv_name = (ImageView) mContentView.findViewById(R.id.iv_name);
//        iv_car = (ImageView) mContentView.findViewById(R.id.iv_car);
//    }

//    private void setUpView() {
//        mPrepaidView.setOnClickListener(this);
//        mMoneyView.setOnClickListener(this);
//        mMoneyDetilView.setOnClickListener(this);
//        mPayPasswordView.setOnClickListener(this);
//        mCouponView.setOnClickListener(this);
//        mMyPointsView.setOnClickListener(this);
//        mBrowseRecord.setOnClickListener(this);
//        mShareAppView.setOnClickListener(this);
//
//        ll_pay_account.setOnClickListener(this);
//        ll_my_address.setOnClickListener(this);
//        ll_my_comment.setOnClickListener(this);
//        tv_modify_info.setOnClickListener(this);
//        ll_user_info.setOnClickListener(this);
//
//
//        SpannableString span = new SpannableString("0.00元");
//        span.setSpan(new AbsoluteSizeSpan(13, true), span.length() - 1, span.length(), SpannableString.SPAN_EXCLUSIVE_INCLUSIVE);
//        mOverageView.setText(span);
//
//        if (!AccountManager.isUserAuth()) {
//            iv_name.setVisibility(View.GONE);
//            iv_car.setVisibility(View.GONE);
//        } else if (!AccountManager.isCarAuth()) {
//            iv_car.setVisibility(View.GONE);
//        }
//    }
//
//    @Override
//    public void onClick(View v) {
//        switch (v.getId()) {
//            case R.id.tv_prepaid:
//                startActivity(new Intent(getActivity(), RechangeActivity.class));
//                break;
//            case R.id.tv_money:
//                if (data != null) {
//                    Intent intent = new Intent(getActivity(), WithdrawForAccountActivity.class);
//                    intent.putExtra(ExtraName.freetotal, data.getFreetotal());
//                    startActivity(intent);
//                } else {
//                    ((BaseActivity) getActivity()).showToast(R.string.please_check_network);
//                }
//                break;
//            case R.id.ll_money_detil:
//                startActivity(new Intent(getActivity(), IncomeStatementActivity.class));
//                break;
//            case R.id.ll_pay_password:
//                Intent intent = new Intent(getActivity(), PayManageActivity.class);
//                intent.putExtra(ExtraName.isHavePasswd, isHavePasswd);
//                startActivity(intent);
//                break;
//            case R.id.ll_coupon:
//                startActivity(new Intent(getActivity(), CouponActivity.class));
//                break;
//            case R.id.ll_share_app:
//            /*Intent generalizeIntent = new Intent(getActivity(), MyGeneralizeActivity.class);
//            generalizeIntent.putExtra(ExtraName.shareType, MyGeneralizeActivity.SHARE_TYPE_APP);
//			startActivity(generalizeIntent);*/
//                ShareParams params = new ShareParams();
//                params.setTitle(ShareContent.SHARE_APP_CONTENT);
//                params.setTitleUrl(HttpConfig.WebPage.SHARE);
//                params.setText(ShareContent.SHARE_APP_CONTENT);
//                params.setImageUrl(HttpConfig.WebPage.SHARE_IMAGE_PATH);
//                params.setUrl(HttpConfig.WebPage.SHARE);
//                ShareFactory.showShare(getActivity(), params);
//                break;
//            case R.id.ll_my_points:
//                if (AccountManager.isLogin()) {
//                    startActivity(new Intent(getActivity(), MyPointsActivity.class));
//                } else {
//                    startActivity(new Intent(getActivity(), LoginActivity.class));
//                }
//                break;
//            case R.id.ll_browse_record:
//                if (AccountManager.isLogin()) {
//                    startActivity(new Intent(getActivity(), EcBrowseRecordActivity.class));
//                } else {
//                    startActivity(new Intent(getActivity(), LoginActivity.class));
//                }
//                break;
//            case R.id.ll_pay_account:
//                startActivity(new Intent(getActivity(), PayAccountActivity.class));
//                break;
//            case R.id.ll_my_address:
//                startActivity(new Intent(getActivity(), AddressManagerActivity.class));
//                break;
//            case R.id.ll_my_comment:
//                if (AccountManager.isLogin()) {
//                    startActivity(new Intent(getActivity(), MyEvaluationActivity.class));
//                } else {
//                    startActivity(new Intent(getActivity(), LoginActivity.class));
//                }
//                break;
//            case R.id.ll_user_info:
//            case R.id.tv_modify_info:
//                startActivity(new Intent(getActivity(), MyInfoActivity.class));
//                break;
//        }
//    }
//
//    /**
//     * 请求网络获得账户详情
//     */
//    private void getAccountDetail() {
//        ((BaseActivity) getActivity()).startLoadingDialog();
//        RequestService.getInstance().getAccountDetail(getActivity(), AccountDetailEntity.class, new RequestListener() {
//
//            @Override
//            public void onSuccess(int requestCode, BaseEntity resultData) {
//                ((BaseActivity) getActivity()).dismissLoadingDialog();
//                if (resultData.isOk()) {
//                    AccountDetailEntity entity = (AccountDetailEntity) resultData;
//                    updateUi(entity);
//                } else {
//                    ((BaseActivity) getActivity()).showToast(resultData.getMsg());
//                }
//            }
//
//            @Override
//            public void onFailed(int requestCode, Exception error, String msg) {
//                BaseActivity activity = (BaseActivity) getActivity();
//                if (activity != null) {
//                    activity.dismissLoadingDialog();
//                    activity.showToast(R.string.please_check_network);
//                }
//            }
//        });
//    }

//    /**
//     * 根据账户详情 填充账务余额
//     *
//     * @param entity
//     */
//    protected void updateUi(AccountDetailEntity entity) {
//        data = entity.getData();
//
////		mOverageView.setText(Data.getFreetotal());
//        SpannableString span = new SpannableString(data.getFreetotal() + "元");
//        span.setSpan(new AbsoluteSizeSpan(13, true), span.length() - 1, span.length(), SpannableString.SPAN_EXCLUSIVE_INCLUSIVE);
//        mOverageView.setText(span);
//    }
//
//    /* (non-Javadoc)
//     * @see android.support.v4.app.Fragment#onResume()
//     */
    @Override
    public void onResume() {
        super.onResume();
        RequestData();
    }

}
